package com.idlestar.androiddocs.view.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.Choreographer;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.AnimationUtils;
import android.view.animation.ScaleAnimation;
import android.view.animation.TranslateAnimation;
import android.widget.Scroller;

import com.idlestar.androiddocs.R;

public class TranslateAnimActivity extends Activity {
    private TranslateAnimation mMoveAnim;
    private ScaleAnimation mScaleAnim;
    private AnimationSet animSet;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_translate_anim);

        animSet = new AnimationSet(false);

        ScaleAnimation scaleBig = new ScaleAnimation(1, 0.8f, 1f, 0.8f);
        scaleBig.setDuration(600);
        scaleBig.setFillEnabled(false);
        scaleBig.setFillAfter(true);
        animSet.addAnimation(scaleBig);

        ScaleAnimation scaleSmall = new ScaleAnimation(1f, 1.25f, 1f, 1.25f);
        scaleSmall.setDuration(600);
        scaleSmall.setStartOffset(700);
        scaleBig.setFillEnabled(false);
        scaleSmall.setFillAfter(true);
        animSet.addAnimation(scaleSmall);

        mMoveAnim = new TranslateAnimation(0, 0, 0, 300);
        mMoveAnim.setDuration(600);
        mMoveAnim.setStartOffset(1400);
        mMoveAnim.setFillAfter(true);
        animSet.addAnimation(mMoveAnim);

    }

    public void startMove(View view) {
        view.clearAnimation();
        view.startAnimation(animSet);
    }
}
